<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue组件</title>
</head>
<body>
<div id="app">
    <xyc v-for="item in items" v-bind:x="item"></xyc>
</div>

<script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>
<script>
    // 定义Vue组件
    Vue.component("xyc", {
        props: ['x'],
        template: '<li>{{x}}</li>'
    });

    var app = new Vue({
        el: "#app",
        data: {
            items: ["Java", "Linux", "前端"]
        }
    })

</script>
</body>
</html>
